#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<string>
using namespace std;

int main()
{
	string s, st;
	cin >> s;

	for (auto ch : s)
	{
		if (st.size() && st.back() == ch)
		{
			st.pop_back();
		}
		else
		{
			st += ch;
		}
	}

	cout << (st.size() == 0 ? "0" : st) << endl;

	return 0;
}